package de.lns.render;

import static org.lwjgl.opengl.GL15.*;

import java.nio.FloatBuffer;


public class AnimatedLayer extends Layer {
	private int[] animState;
	private int animIndex;
	public AnimatedLayer(Model target, FloatBuffer verts, FloatBuffer maps){
		super(target, verts, maps);
		animState = target.getAnimStates();
		animIndex = target.getAnimCounter() -1;
	}

	@Override
	protected void writeVertices(int offset) {
		vertices.position(12*animState[animIndex]+12);
		vertices.mark();
		vertices.position(12*animState[animIndex]);
		glBufferSubData(GL_ARRAY_BUFFER, offset, vertices.slice());
	}

	@Override
	protected void writeMapping(int offset) {
		glBufferSubData(GL_ARRAY_BUFFER, offset, texCoords);
	}
}
